<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>sprox_mifare_c.html</title>
<!-- Source : c:/temp/springprox_api/sprox_mifare.c -->
<!-- Doc generated on Thu Jun 24 12:26:29 2010 by johann on PC_DEV_5 -->
<!-- Generated with ROBODoc Version 4.99.8 (Specific build by PRO ACTIVE - Apr 13 2010) -->
<style type="text/css">
body
{
  background-color: #ffffff;
  color: #000000;
  font-family: Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
  font-size: 9pt;
  margin-left: 60px;
  margin-right: 40px;  
}
table
{
  border-collapse: collapse;
  border-style: solid;
  border-width: 1px;
  border-color: #000000;
  margin-bottom: 12px;
}
td
{
  font-family: Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
  font-size: 9pt;
  vertical-align: top;
  padding-right: 6px;
  border-style: solid;
  border-width: 1px;
  border-color: #dddddd; 
}
th
{
  font-family: Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
  font-size: 9pt;
  vertical-align: top;  
  padding-right: 6px;
  border-style: solid;
  border-width: 1px;
  border-color: #000000;
  background-color: #dddddd;  
}
h1
{
  font-family: Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
  font-size: 18pt;
  font-weight: bold;
  margin-bottom: 36px;
  color: #000000;
  margin-left: -40px;
}
h2
{
  font-family: Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
  font-size: 12pt;
  font-weight: bold;
  margin-top: 48px;
  margin-bottom: 24px;
  padding-top: 2px;
  padding-bottom: 2px;
  background-color: #dddddd;
  color: #000000;
  margin-left: -40px;
}
h3
{
  font-family: Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
  font-size: 11pt;
  font-weight: bold;
  margin-top: 36px;
  margin-bottom: 24px; 
  border-style: none;
  border-top-style: solid;  
  border-width: 1px;
  border-color: #cccccc; 
  margin-left: -40px;
}
h4
{
  font-family: Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
  font-size: 11pt;
  font-weight: bold;
  margin-top: 24px;
  margin-bottom: 12px;  
}
h5
{
  font-family: Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
  font-size: 9pt;
  font-weight: bold;
  margin-top: 12px;
  margin-bottom: 2px;  
}
a
{
  color: #0000ff;
}
p
{
  margin-top: 0px;
  margin-bottom: 6px;  
  width: 600px;
  text-align: justify;
}
ul
{
  margin-top: 0px;
  margin-bottom: 6px;  
  width: 600px;
  text-align: justify;
}
li
{
  margin-top: 0px;
  margin-bottom: 6px;  
  width: 550px;
  text-align: justify;
}
tt
{
  font-family: Courier, Courier New;
  font-size: 10pt;
}
pre
{
  background-color: #ffffff;
  color: #000000;
  font-size: 10pt;
}
.NAV
{
  font-size: 7pt;
}
a.NAV
{
  color: #0000cc;
}
.TOC
{
  font-size: 9pt;
  color: #888888;
}
a.TOC
{
  color: #0000ff;
}
.INDEX
{
  font-size: 9pt;
}
a.INDEX
{
  color: #0000ff;
}
.TYPE
{
  font-size: 7pt;
  color: #888888;
}
.ITEM
{
  font-weight: bold;
  color: #000088;
}
.LABEL
{
  color: #000088;
}
.HISTORY
{
  color: #006600;
}
.AUTHOR
{
  color: #006600;
}
.COPYRIGHT
{
  color: #006600;
}
.PORTABILITY
{
  color: #006600;
}
.WARNING
{
  color: #aa0000;
}

.bitinfo
{
  width: 60px;
  font-style: italic;
  text-align: center;
}

.bitnum
{
  text-align: center;
}

.bitname
{
  font-weight: bold;
  text-align: center;
}

.tabitem
{
  width: 100px;
}

.tabname
{
  width: 200px;
}

.tabdesc
{
  width: 450px;
}

.value
{
  font-family: courier;
  text-align: right;
}

.tabsepar
{
  border-top-style: solid;
  border-bottom-style: solid;
  border-width: 2px;
  border-color: #888888;
  font-style: italic;
  text-align: center;
}
</style>
</head>
<body bgcolor="#FFFFFF">
<a name="robo_top_of_doc"></a>
<h3 align="center">TABLE OF CONTENTS</h3>
<ul>
<li><a class="TOC" href="#robo10">Mifare</a></li>
<li><a class="TOC" href="#robo12">ACC_AUTH_NORMAL</a></li>
<li><a class="TOC" href="#robo13">ACC_AUTH_TRANSPORT</a></li>
<li><a class="TOC" href="#robo14">ACC_BLOCK_COUNT</a></li>
<li><a class="TOC" href="#robo15">ACC_BLOCK_VALUE</a></li>
<li><a class="TOC" href="#robo71">SPROX_MifLastAuthKey</a></li>
<li><a class="TOC" href="#robo72">SPROX_MifLoadKey</a></li>
<li><a class="TOC" href="#robo73">SPROX_MifRead</a></li>
<li><a class="TOC" href="#robo74">SPROX_MifStDecrementCounter</a></li>
<li><a class="TOC" href="#robo75">SPROX_MifStHalt</a></li>
<li><a class="TOC" href="#robo76">SPROX_MifStReadBlock</a></li>
<li><a class="TOC" href="#robo77">SPROX_MifStReadCounter</a></li>
<li><a class="TOC" href="#robo78">SPROX_MifStReadSector</a></li>
<li><a class="TOC" href="#robo79">SPROX_MifStReadTag768</a></li>
<li><a class="TOC" href="#robo80">SPROX_MifStSelectAgain</a></li>
<li><a class="TOC" href="#robo81">SPROX_MifStSelectAny</a></li>
<li><a class="TOC" href="#robo82">SPROX_MifStSelectIdle</a></li>
<li><a class="TOC" href="#robo83">SPROX_MifStUpdateAccessBlock</a></li>
<li><a class="TOC" href="#robo84">SPROX_MifStWriteBlock</a></li>
<li><a class="TOC" href="#robo85">SPROX_MifStWriteCounter</a></li>
<li><a class="TOC" href="#robo86">SPROX_MifStWriteSector</a></li>
<li><a class="TOC" href="#robo87">SPROX_MifStWriteTag768</a></li>
<li><a class="TOC" href="#robo88">SPROX_MifWrite</a></li>
<li><a class="TOC" href="#robo89">SPROX_MifWrite4</a></li>
</ul>
<h3>&nbsp;</h3>


<h1><a name="robo10"><span class="TYPE">[Modules]</span><a class="LABEL" name="Mifare">
Mifare</a></h1>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./Copie de springprox_h.html#robo1">parent</a>][<a class="NAV" href="./modules.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <a class="LINK_1" href="./springprox_h.html#robo0">SpringProxAPI</a> :: <strong>Mifare</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Implementation of Philips <strong>Mifare</strong> functions
   (<strong>Mifare</strong> Standard and <strong>Mifare</strong> UltraLite)
</pre>
</span>


<h2><a name="robo12"><span class="TYPE">[Definitions]</span><a class="LABEL" name="ACC5fAUTH5fNORMAL">
ACC_AUTH_NORMAL</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./Copie de springprox_h.html#robo1">parent</a>][<a class="NAV" href="./definitions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>ACC_AUTH_NORMAL</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Recommended access condition for a <a class="LINK_6" href="#robo10">Mifare</a> sector trailer :
   - key 'A' doesn't give access to sector trailer
   - key 'B' gives full access to sector trailer (sectors' master key)
</pre>
</span><p class="ITEM">NOTES</p>
<span class="NOTES"><pre class="NOTES">   This constant is to be used as parameter ac3 of <a class="LINK_23" href="#robo83">SPROX_MifStUpdateAccessBlock</a>.
</pre>
</span>


<h2><a name="robo13"><span class="TYPE">[Definitions]</span><a class="LABEL" name="ACC5fAUTH5fTRANSPORT">
ACC_AUTH_TRANSPORT</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./Copie de springprox_h.html#robo1">parent</a>][<a class="NAV" href="./definitions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>ACC_AUTH_TRANSPORT</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   "Transport" access condition of a <a class="LINK_6" href="#robo10">Mifare</a> sector trailer :
   - key 'A' gives full access to sector trailer (sectors' master key)
   - key 'B' is not used for authentication (and thus readable with key 'A')
</pre>
</span><p class="ITEM">NOTES</p>
<span class="NOTES"><pre class="NOTES">   This constant is to be used as parameter ac3 of <a class="LINK_23" href="#robo83">SPROX_MifStUpdateAccessBlock</a>.
</pre>
</span>


<h2><a name="robo14"><span class="TYPE">[Definitions]</span><a class="LABEL" name="ACC5fBLOCK5fCOUNT">
ACC_BLOCK_COUNT</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./Copie de springprox_h.html#robo1">parent</a>][<a class="NAV" href="./definitions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>ACC_BLOCK_COUNT</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Recommended access condition for a <a class="LINK_6" href="#robo10">Mifare</a> block used as a counter :
   - key 'A' offers read and decrement only access
   - key 'B' offers read, write, decrement and increment access
</pre>
</span><p class="ITEM">NOTES</p>
<span class="NOTES"><pre class="NOTES">   This constant is to be used as parameter ac0, ac1 and ac2 of 
   <a class="LINK_23" href="#robo83">SPROX_MifStUpdateAccessBlock</a>.
</pre>
</span>


<h2><a name="robo15"><span class="TYPE">[Definitions]</span><a class="LABEL" name="ACC5fBLOCK5fVALUE">
ACC_BLOCK_VALUE</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./Copie de springprox_h.html#robo1">parent</a>][<a class="NAV" href="./definitions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>ACC_BLOCK_VALUE</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Recommended access condition for a <a class="LINK_6" href="#robo10">Mifare</a> block used as data storage :
   - key 'A' offers read only access
   - key 'B' offers read and write access
</pre>
</span><p class="ITEM">NOTES</p>
<span class="NOTES"><pre class="NOTES">   This constant is to be used as parameter ac0, ac1 and ac2 of 
   <a class="LINK_23" href="#robo83">SPROX_MifStUpdateAccessBlock</a>.
</pre>
</span>


<h2><a name="robo71"><span class="TYPE">[Functions]</span><a class="LABEL" name="SPROX5fMifLastAuthKey">
SPROX_MifLastAuthKey</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./Copie de springprox_h.html#robo1">parent</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>SPROX_MifLastAuthKey</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Returns the last <a class="LINK_6" href="#robo10">Mifare</a> key that has allowed a successfull read or
   write operation.
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   BYTE *info         : pointer to a byte to return the expected information 
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   MI_OK              : success, data have been read
   Other code if internal or communication error has occured. 
</pre>
</span><p class="ITEM">NOTES</p>
<span class="NOTES"><pre class="NOTES">   Returned value for info is a bit-field coded as follow :

   xxxxxxxx
      +++++-- key number   : offset of the key in RAM or EEPROM
     +------- key type     : 1 for a 'B' key, 0 for an 'A' key
   ++-------- key provider : 10 for a key found in reader's RAM
                             01 for a key found in RC chipset's EEPROM
                             11 if the key has been passed directly to
                                the function (no automatic discovery). 
                             00 is RFU
</pre>
</span>


<h2><a name="robo72"><span class="TYPE">[Functions]</span><a class="LABEL" name="SPROX5fMifLoadKey">
SPROX_MifLoadKey</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./Copie de springprox_h.html#robo1">parent</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>SPROX_MifLoadKey</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Load <a class="LINK_6" href="#robo10">Mifare</a> key into the reader. It will be used by every function
   performing automatic key trying.
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   BOOL eeprom            : set to TRUE for EEPROM storage
                            set to FALSE for temporary RAM storage
   BYTE key_type          : set to 'A' for a <a class="LINK_12" href="#robo10">Mifare</a> A key
                            set to 'B' for a <a class="LINK_12" href="#robo10">Mifare</a> B key
   BYTE key_offset        : index of the key into the memory
                            - 0 to 15 for EEPROM storage
                            - 0 to 3 for RAM storage
   const BYTE key_data[6] : value of the key
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   MI_OK              : success, key has been written
   Other code if internal or communication error has occured. 
</pre>
</span><p class="ITEM">WARNING</p>
<span class="WARNING"><pre class="WARNING">   EEPROM keys are stored in the RC chipset EEPROM. Do not write the keys
   "too often" since an EEPROM has a limited lifetime depending on the
   write operations count.

   Typically, load your application keys in EEPROM once at product install,
   then forget it...
</pre>
</span><p class="ITEM">NOTES</p>
<span class="NOTES"><pre class="NOTES">   There's not mean to read back the loaded keys.

   Highest performance will be achieved when the right authentication key for
   a block or a sector is available at the beginning of the RAM or of
   the EEPROM !
</pre>
</span><p class="ITEM">SEE ALSO</p>
<span class="SEE_ALSO"><pre class="SEE ALSO">   <a class="LINK_37" href="#robo71">SPROX_MifLastAuthKey</a>
</pre>
</span>


<h2><a name="robo73"><span class="TYPE">[Functions]</span><a class="LABEL" name="SPROX5fMifRead">
SPROX_MifRead</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./Copie de springprox_h.html#robo1">parent</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>SPROX_MifRead</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Read one 16-byte block of a <a class="LINK_6" href="#robo10">Mifare</a> card.
   No implicit authentication is performed ; this is typically the appropriate
   function to read from a <a class="LINK_6" href="#robo10">Mifare</a> UltraLight card.
</pre>
</span><p class="ITEM">WARNING</p>
<span class="WARNING"><pre class="WARNING">   On a <a class="LINK_28" href="#robo10">Mifare</a> Standard card, authentication is mandatory, use <a class="LINK_28" href="#robo76">SPROX_MifStReadBlock</a>.
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   const BYTE snr[4]  : 4-byte UID of the <a class="LINK_12" href="#robo10">Mifare</a> card to read
                        If NULL, the reader will work with currently selected card
   BYTE address       : address to read
   BYTE data[16]      : 16-byte buffer to receive the data
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   MI_OK              : success, data have been read
   MI_NOTAGERR        : the required card is not available in the RF field
   Other code if internal or communication error has occured. 
</pre>
</span><p class="ITEM">SEE ALSO</p>
<span class="SEE_ALSO"><pre class="SEE ALSO">   <a class="LINK_37" href="#robo88">SPROX_MifWrite</a>
   <a class="LINK_37" href="#robo76">SPROX_MifStReadBlock</a>
</pre>
</span>


<h2><a name="robo74"><span class="TYPE">[Functions]</span><a class="LABEL" name="SPROX5fMifStDecrementCounter">
SPROX_MifStDecrementCounter</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./Copie de springprox_h.html#robo1">parent</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>SPROX_MifStDecrementCounter</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Decrement a <a class="LINK_6" href="#robo10">Mifare</a> tag counter, using given key or internally available
   keys for authentication.
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   const BYTE snr[4]  : 4-byte UID of the <a class="LINK_12" href="#robo10">Mifare</a> card
                        If NULL, the reader will work with currently selected tag
   BYTE  bloc         : address of the block holding the counter
   DWORD value        : number of units the counter is to be decremented
   const BYTE key[6]  : The <a class="LINK_12" href="#robo10">Mifare</a> access key of the sector (either A or B)
                        If NULL, the reader will try all the preloaded keys
</pre>
</span><p class="ITEM">WARNING</p>
<span class="WARNING"><pre class="WARNING">   This function works only on <a class="LINK_28" href="#robo10">Mifare</a> blocks that have been explicitly defined
   as counter (access condition <a class="LINK_28" href="#robo14">ACC_BLOCK_COUNT</a>) and that have been previously
   correctly initialized through <a class="LINK_28" href="#robo85">SPROX_MifStWriteCounter</a>.

   For more details, please refer to specific tag documentation.
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   MI_OK              : success, data have been read
   MI_NOTAGERR        : the required tag is not available in the RF field,
                        or the supplied key has been denied
   MI_AUTHERR         : access to the block has been denied
   Other code if internal or communication error has occured. 
</pre>
</span><p class="ITEM">NOTES</p>
<span class="NOTES"><pre class="NOTES">   The automatic key trying sequence is the same as in <a class="LINK_23" href="#robo76">SPROX_MifStReadBlock</a>.
</pre>
</span><p class="ITEM">SEE ALSO</p>
<span class="SEE_ALSO"><pre class="SEE ALSO">   <a class="LINK_37" href="#robo77">SPROX_MifStReadCounter</a>
   <a class="LINK_37" href="#robo85">SPROX_MifStWriteCounter</a>
</pre>
</span>


<h2><a name="robo75"><span class="TYPE">[Functions]</span><a class="LABEL" name="SPROX5fMifStHalt">
SPROX_MifStHalt</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./Copie de springprox_h.html#robo1">parent</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>SPROX_MifStHalt</strong>
</pre>
</span><p class="ITEM">WARNING</p>
<span class="WARNING"><pre class="WARNING">   This function is deprecated. Use <a class="LINK_28" href="./sprox_14443-3_c.html#robo19">SPROX_A_Halt</a> instead.
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   none
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   MI_OK              : success, card halted
   Other code if internal or communication error has occured. 
</pre>
</span><p class="ITEM">SEE ALSO</p>
<span class="SEE_ALSO"><pre class="SEE ALSO">   <a class="LINK_37" href="./sprox_14443-3_c.html#robo19">SPROX_A_Halt</a>
</pre>
</span>


<h2><a name="robo76"><span class="TYPE">[Functions]</span><a class="LABEL" name="SPROX5fMifStReadBlock">
SPROX_MifStReadBlock</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./Copie de springprox_h.html#robo1">parent</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>SPROX_MifStReadBlock</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Read one 16-byte block of a <a class="LINK_6" href="#robo10">Mifare</a> tag, using given key or internally available
   keys for authentication.
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   const BYTE snr[4]  : 4-byte UID of the <a class="LINK_12" href="#robo10">Mifare</a> card to read
                        If NULL, the reader will work with currently selected tag
   BYTE bloc          : address of the block to read
   BYTE data[16]      : 16-byte buffer to receive the data
   const BYTE key[6]  : The <a class="LINK_12" href="#robo10">Mifare</a> access key of the sector (either A or B)
                        If NULL, the reader will try all the preloaded keys
</pre>
</span><p class="ITEM">WARNING</p>
<span class="WARNING"><pre class="WARNING">   The number of blocks available on a <a class="LINK_28" href="#robo10">Mifare</a> tag depends on the tag type.

   For example, a <a class="LINK_28" href="#robo10">Mifare</a> classic 1k tag stores 64 blocks (address 0 to 63), a
   <a class="LINK_28" href="#robo10">Mifare</a> classic 4k tag stores 256 blocks (address 0 to 255).
   The last block of each <a class="LINK_28" href="#robo10">Mifare</a> classic sector is known as security block (or
   sector trailer) and holds the access keys to the sector. This functions allows
   reading of those specific blocks, but the keys are masked by <a class="LINK_28" href="#robo10">Mifare</a> integrated
   security features.

   For more details, please refer to specific tag documentation.
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   MI_OK              : success, data have been read
   MI_NOTAGERR        : the required tag is not available in the RF field,
                        or the supplied key has been denied
   MI_AUTHERR         : access to the block has been denied
   Other code if internal or communication error has occured. 
</pre>
</span><p class="ITEM">NOTES</p>
<span class="NOTES"><pre class="NOTES">   If key is not NULL, it is tried first as an 'A' key, then on failure as a 'B' key.

   If not <a class="LINK_23" href="#robo10">Mifare</a> key is supplied, the reader automatically tries every keys
   available in its memory.
   If key is NULL, the key trying sequence is performed in this order :
   - 4  'A' keys stored in reader's RAM (if no key has been loaded into
     RAM since reader's last reset, this is skipped),
   - 4  'B' keys stored in reader's RAM (if no key has been loaded into
     RAM since reader's last reset, this is skipped),
   - 16 'A' keys stored in the RC chipset's EEPROM
   - 16 'B' keys stored in the RC chipset's EEPROM

   Highest performance will be achieved when the right authentication key for
   this block is available at the beginning of this sequence !

   After a succesfull read action, you can retrieve the key that has been used
   with <a class="LINK_23" href="#robo71">SPROX_MifLastAuthKey</a>.
</pre>
</span><p class="ITEM">SEE ALSO</p>
<span class="SEE_ALSO"><pre class="SEE ALSO">   <a class="LINK_37" href="#robo72">SPROX_MifLoadKey</a>
   <a class="LINK_37" href="#robo78">SPROX_MifStReadSector</a>
</pre>
</span>


<h2><a name="robo77"><span class="TYPE">[Functions]</span><a class="LABEL" name="SPROX5fMifStReadCounter">
SPROX_MifStReadCounter</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./Copie de springprox_h.html#robo1">parent</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>SPROX_MifStReadCounter</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Read a <a class="LINK_6" href="#robo10">Mifare</a> tag counter, using given key or internally available
   keys for authentication.
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   const BYTE snr[4]  : 4-byte UID of the <a class="LINK_12" href="#robo10">Mifare</a> card
                        If NULL, the reader will work with currently selected tag
   BYTE   bloc        : address of the block holding the counter
   SDWORD *value      : pointer to receive current counter value
   const BYTE key[6]  : The <a class="LINK_12" href="#robo10">Mifare</a> access key of the sector (either A or B)
                        If NULL, the reader will try all the preloaded keys
</pre>
</span><p class="ITEM">WARNING</p>
<span class="WARNING"><pre class="WARNING">   This function works only on <a class="LINK_28" href="#robo10">Mifare</a> blocks that have been explicitly defined
   as counter (access condition <a class="LINK_28" href="#robo14">ACC_BLOCK_COUNT</a>) and that have been previously
   correctly initialized through <a class="LINK_28" href="#robo85">SPROX_MifStWriteCounter</a>.

   For more details, please refer to specific tag documentation.
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   MI_OK              : success, data have been read
   MI_NOTAGERR        : the required tag is not available in the RF field,
                        or the supplied key has been denied
   MI_AUTHERR         : access to the block has been denied
   Other code if internal or communication error has occured. 
</pre>
</span><p class="ITEM">NOTES</p>
<span class="NOTES"><pre class="NOTES">   The automatic key trying sequence is the same as in <a class="LINK_23" href="#robo76">SPROX_MifStReadBlock</a>.
</pre>
</span><p class="ITEM">SEE ALSO</p>
<span class="SEE_ALSO"><pre class="SEE ALSO">   <a class="LINK_37" href="#robo85">SPROX_MifStWriteCounter</a>
   <a class="LINK_37" href="#robo74">SPROX_MifStDecrementCounter</a>
</pre>
</span>


<h2><a name="robo78"><span class="TYPE">[Functions]</span><a class="LABEL" name="SPROX5fMifStReadSector">
SPROX_MifStReadSector</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./Copie de springprox_h.html#robo1">parent</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>SPROX_MifStReadSector</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Read one sector of a <a class="LINK_6" href="#robo10">Mifare</a> tag, using given key or internally available
   keys for authentication.
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   const BYTE snr[4]  : 4-byte UID of the <a class="LINK_12" href="#robo10">Mifare</a> card to read
                        If NULL, the reader will work with currently selected tag
   BYTE sect          : address of the sector to read
   BYTE data[48/240]  : 48-byte or 240-byte buffer to receive the data
   const BYTE key[6]  : The <a class="LINK_12" href="#robo10">Mifare</a> access key of the sector (either A or B)
                        If NULL, the reader will try all the preloaded keys
</pre>
</span><p class="ITEM">WARNING</p>
<span class="WARNING"><pre class="WARNING">   The number of sectors available on a <a class="LINK_28" href="#robo10">Mifare</a> tag depends on the tag type.
   The size of each sector depends both on the tag type and on the sector number.

   For example, a <a class="LINK_28" href="#robo10">Mifare</a> classic 1k tag has 16 sectors (address 0 to 15). Each
   sector has a size of 3+1 blocks (48 bytes of data). A <a class="LINK_28" href="#robo10">Mifare</a> classic 4k tag 
   has 40 sectors (address 0 to 39). Sectors 0 to 31 have a size of 3+1 blocks
   (48 bytes of data), while sectors 32 to 39 have a size of 15+1 blocks (240
   bytes of data).

   For more details, please refer to specific tag documentation.

   This function never returns the last block of each sector (security block or
   sector trailer). Explicitly use <a class="LINK_28" href="#robo76">SPROX_MifStReadBlock</a> to access those blocks.
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   MI_OK              : success, data have been read
   MI_NOTAGERR        : the required tag is not available in the RF field,
                        or the supplied key has been denied
   MI_AUTHERR         : access to the sector has been denied
   Other code if internal or communication error has occured. 
</pre>
</span><p class="ITEM">NOTES</p>
<span class="NOTES"><pre class="NOTES">   The automatic key trying sequence is the same as in <a class="LINK_23" href="#robo76">SPROX_MifStReadBlock</a>.
</pre>
</span><p class="ITEM">SEE ALSO</p>
<span class="SEE_ALSO"><pre class="SEE ALSO">   <a class="LINK_37" href="#robo76">SPROX_MifStReadBlock</a>
</pre>
</span>


<h2><a name="robo79"><span class="TYPE">[Functions]</span><a class="LABEL" name="SPROX5fMifStReadTag768">
SPROX_MifStReadTag768</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./Copie de springprox_h.html#robo1">parent</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>SPROX_MifStReadTag768</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Read a whole <a class="LINK_6" href="#robo10">Mifare</a> 1k tag (768 bytes), using internally available keys for
   authentication.
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   const BYTE snr[4]  : 4-byte UID of the <a class="LINK_12" href="#robo10">Mifare</a> card to read
                        If NULL, the reader will work with currently selected tag
   WORD *sectors      : pointer to a WORD used as bit-array
                        - in input, bit b(i) set means that sector i must be read
                        - in output, bit b(i) set means that sector i has been
                          successfully read
   BYTE data[768]     : 768-byte buffer to receive the data
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   MI_OK              : success, some data have been read. Check the *sectors bit-
                        array to see which sectors have been read
   MI_NOTAGERR        : the required tag is not available in the RF field,
                        or the supplied key has been denied
   Other code if internal or communication error has occured. 
</pre>
</span><p class="ITEM">NOTES</p>
<span class="NOTES"><pre class="NOTES">   The automatic key trying sequence is the same as in <a class="LINK_23" href="#robo84">SPROX_MifStWriteBlock</a>.
</pre>
</span><p class="ITEM">SEE ALSO</p>
<span class="SEE_ALSO"><pre class="SEE ALSO">   <a class="LINK_37" href="#robo76">SPROX_MifStReadBlock</a>
   <a class="LINK_37" href="#robo78">SPROX_MifStReadSector</a>
</pre>
</span>


<h2><a name="robo80"><span class="TYPE">[Functions]</span><a class="LABEL" name="SPROX5fMifStSelectAgain">
SPROX_MifStSelectAgain</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./Copie de springprox_h.html#robo1">parent</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>SPROX_MifStSelectAgain</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Allow to re-select an ISO 14443-A card, provided its serial number (the card
   must be available in the RF field, either in the IDLE or HALTed state).
</pre>
</span><p class="ITEM">WARNING</p>
<span class="WARNING"><pre class="WARNING">   This function is deprecated. Use <a class="LINK_28" href="./sprox_14443-3_c.html#robo20">SPROX_A_SelectAgain</a> instead.
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   const BYTE snr[4]  : 4-byte Unique ID of the card to wake-up
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   MI_OK              : success, card selected
   MI_NOTAGERR        : the required card is not available in the RF field
   Other code if internal or communication error has occured. 
</pre>
</span><p class="ITEM">SEE ALSO</p>
<span class="SEE_ALSO"><pre class="SEE ALSO">   <a class="LINK_37" href="./sprox_14443-3_c.html#robo20">SPROX_A_SelectAgain</a>
</pre>
</span>


<h2><a name="robo81"><span class="TYPE">[Functions]</span><a class="LABEL" name="SPROX5fMifStSelectAny">
SPROX_MifStSelectAny</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./Copie de springprox_h.html#robo1">parent</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>SPROX_MifStSelectAny</strong>
</pre>
</span><p class="ITEM">WARNING</p>
<span class="WARNING"><pre class="WARNING">   This function is deprecated. Use <a class="LINK_28" href="./sprox_14443-3_c.html#robo21">SPROX_A_SelectAny</a> instead.
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   BYTE snr[4]        : 4-byte buffer to receive card's Unique ID
   BYTE atq[2]        : 2-byte buffer to receive card's Answer To Query
   BYTE sak[1]        : 1-byte buffer to receive card's Select AcKnowledge
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   MI_OK              : success, card selected
   MI_NOTAGERR        : no card available in the RF field
   Other code if internal or communication error has occured. 
</pre>
</span><p class="ITEM">NOTES</p>
<span class="NOTES"><pre class="NOTES">   Despite the name of the function, it doesn't check the returned card type
   (i.e., any ISO 14443-A card will be selected, not only <a class="LINK_23" href="#robo10">Mifare</a> cards).

   Please refer to Philips "<a class="LINK_23" href="#robo10">Mifare</a> Type Identification Procedure" documentation
   for atq and sak explanation.

   The Unique ID size is to be found in atq[0] :
   (atq[0] &amp; 0xC0 == 0x00) --&gt; single size UID (snr is 4-byte long)
   (atq[0] &amp; 0xC0 == 0x40) --&gt; double size UID (snr is 7-byte long)
   (atq[0] &amp; 0xC0 == 0x80) --&gt; triple size UID (snr is 10-byte long) 
</pre>
</span><p class="ITEM">SEE ALSO</p>
<span class="SEE_ALSO"><pre class="SEE ALSO">   <a class="LINK_37" href="./sprox_14443-3_c.html#robo21">SPROX_A_SelectAny</a>
   <a class="LINK_37" href="#robo82">SPROX_MifStSelectIdle</a>
</pre>
</span>


<h2><a name="robo82"><span class="TYPE">[Functions]</span><a class="LABEL" name="SPROX5fMifStSelectIdle">
SPROX_MifStSelectIdle</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./Copie de springprox_h.html#robo1">parent</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>SPROX_MifStSelectIdle</strong>
</pre>
</span><p class="ITEM">WARNING</p>
<span class="WARNING"><pre class="WARNING">   This function is deprecated. Use <a class="LINK_28" href="./sprox_14443-3_c.html#robo22">SPROX_A_SelectIdle</a> instead.
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Same as <a class="LINK_6" href="#robo81">SPROX_MifStSelectAny</a>, but will return only a card that is in the IDLE
   state.
   This allow discovering all ISO 14443-A available in the RF field :
   - call <strong>SPROX_MifStSelectIdle</strong> to discover the first card
   - halt this card calling <a class="LINK_6" href="#robo75">SPROX_MifStHalt</a>
   - call <strong>SPROX_MifStSelectIdle</strong> again to discover next card, and so on...
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   BYTE snr[4]        : 4-byte buffer to receive card's Unique ID
   BYTE atq[2]        : 2-byte buffer to receive card's Answer To Query
   BYTE sak[1]        : 1-byte buffer to receive card's Select AcKnowledge
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   MI_OK              : success, card selected
   MI_NOTAGERR        : no IDLE card available in the RF field
   Other code if internal or communication error has occured. 
</pre>
</span><p class="ITEM">NOTES</p>
<span class="NOTES"><pre class="NOTES">   Despite the name of the function, it doesn't check the returned card type
   (i.e., any ISO 14443-A card will be selected, not only <a class="LINK_23" href="#robo10">Mifare</a> cards).
</pre>
</span><p class="ITEM">SEE ALSO</p>
<span class="SEE_ALSO"><pre class="SEE ALSO">   <a class="LINK_37" href="./sprox_14443-3_c.html#robo22">SPROX_A_SelectIdle</a>
   <a class="LINK_37" href="#robo81">SPROX_MifStSelectAny</a>
</pre>
</span>


<h2><a name="robo83"><span class="TYPE">[Functions]</span><a class="LABEL" name="SPROX5fMifStUpdateAccessBlock">
SPROX_MifStUpdateAccessBlock</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./Copie de springprox_h.html#robo1">parent</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>SPROX_MifStUpdateAccessBlock</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Write one a "correctly formated" sector trailer in a <a class="LINK_6" href="#robo10">Mifare</a> tag.
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   const BYTE snr[4]       : 4-byte UID of the <a class="LINK_12" href="#robo10">Mifare</a> card
                             If NULL, the reader will work with currently selected tag
   BYTE sect               : address of the sector (not of the block !!!)
   const BYTE old_key[6]   : current <a class="LINK_12" href="#robo10">Mifare</a> access key of the sector (either B or A)
                             If NULL, the reader will try all the preloaded keys 
   const BYTE new_key_A[6] : new A access key of the sector
   const BYTE new_key_A[B] : new B access key of the sector
   BYTE ac0                : access condition for block 0
   BYTE ac1                : access condition for block 1
   BYTE ac2                : access condition for block 2
   BYTE ac3                : access condition for block 3 (sector trailer itself)
</pre>
</span><p class="ITEM">WARNING</p>
<span class="WARNING"><pre class="WARNING">   Please refer to specific tag documentation for explanation of ac0, ac1, ac2
   and ac3, or use only the values enumerated below :
   - <a class="LINK_28" href="#robo15">ACC_BLOCK_VALUE</a> or <a class="LINK_28" href="#robo14">ACC_BLOCK_COUNT</a> for ac0, ac1 and ac2
   - <a class="LINK_28" href="#robo13">ACC_AUTH_TRANSPORT</a> or <a class="LINK_28" href="#robo12">ACC_AUTH_NORMAL</a> for ac3

   You can also read ClassicAccessConditions for more details.

   Setting bogus access conditions can irremediably lock the sector !
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   MI_OK              : success, access condition have been written
   MI_NOTAGERR        : the required tag is not available in the RF field,
                        or the supplied key has been denied
   MI_AUTHERR         : access to the sector has been denied
   Other code if internal or communication error has occured. 
</pre>
</span><p class="ITEM">NOTES</p>
<span class="NOTES"><pre class="NOTES">   The automatic key trying sequence is the same as in <a class="LINK_23" href="#robo84">SPROX_MifStWriteBlock</a>.  

   If new_key_A is NULL, the reader will write <a class="LINK_23" href="#robo10">Mifare</a> default 'A' base key
   ( 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5 ).
   If new_key_B is NULL, the reader will write <a class="LINK_23" href="#robo10">Mifare</a> default 'B' base key
   ( 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5 ).
</pre>
</span><p class="ITEM">SEE ALSO</p>
<span class="SEE_ALSO"><pre class="SEE ALSO">   <a class="LINK_37" href="#robo72">SPROX_MifLoadKey</a>
</pre>
</span>


<h2><a name="robo84"><span class="TYPE">[Functions]</span><a class="LABEL" name="SPROX5fMifStWriteBlock">
SPROX_MifStWriteBlock</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./Copie de springprox_h.html#robo1">parent</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>SPROX_MifStWriteBlock</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Write one 16-byte block of a <a class="LINK_6" href="#robo10">Mifare</a> tag, using given key or internally available
   keys for authentication.
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   const BYTE snr[4]   : 4-byte UID of the <a class="LINK_12" href="#robo10">Mifare</a> card to read
                         If NULL, the reader will work with currently selected tag
   BYTE bloc           : address of the block to write
   const BYTE data[16] : 16-byte buffer of data
   const BYTE key[6]   : The <a class="LINK_12" href="#robo10">Mifare</a> access key of the sector (either B or A)
                         If NULL, the reader will try all the preloaded keys
</pre>
</span><p class="ITEM">WARNING</p>
<span class="WARNING"><pre class="WARNING">   The last block of each <a class="LINK_28" href="#robo10">Mifare</a> classic sector is known as security block (or
   sector trailer) and holds the access keys to the sector. This functions allows
   writing of those specific blocks, but a malformed block will irremediatly
   lock the sector. We strongly recommend to use <a class="LINK_28" href="#robo83">SPROX_MifStUpdateAccessBlock</a>
   instead.

   For more details, please refer to specific tag documentation.
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   MI_OK              : success, data have been written
   MI_NOTAGERR        : the required tag is not available in the RF field,
                        or the supplied key has been denied
   MI_AUTHERR         : access to the block has been denied
   Other code if internal or communication error has occured. 
</pre>
</span><p class="ITEM">NOTES</p>
<span class="NOTES"><pre class="NOTES">   If key is not NULL, it is tried first as an 'B' key, then on failure as a 'A' key.

   If not <a class="LINK_23" href="#robo10">Mifare</a> key is supplied, the reader automatically tries every keys
   available in its memory.
   If key is NULL, the key trying sequence is performed in this order :
   - 4  'B' keys stored in reader's RAM (if no key has been loaded into
     RAM since reader's last reset, this is skipped),
   - 4  'A' keys stored in reader's RAM (if no key has been loaded into
     RAM since reader's last reset, this is skipped),
   - 16 'B' keys stored in the RC chipset's EEPROM
   - 16 'A' keys stored in the RC chipset's EEPROM

   Highest performance will be achieved when the right authentication key for
   this block is available at the beginning of this sequence !

   After a succesfull read action, you can retrieve the key that has been used
   with <a class="LINK_23" href="#robo71">SPROX_MifLastAuthKey</a>.
</pre>
</span><p class="ITEM">SEE ALSO</p>
<span class="SEE_ALSO"><pre class="SEE ALSO">   <a class="LINK_37" href="#robo72">SPROX_MifLoadKey</a>
   <a class="LINK_37" href="#robo86">SPROX_MifStWriteSector</a>
</pre>
</span>


<h2><a name="robo85"><span class="TYPE">[Functions]</span><a class="LABEL" name="SPROX5fMifStWriteCounter">
SPROX_MifStWriteCounter</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./Copie de springprox_h.html#robo1">parent</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>SPROX_MifStWriteCounter</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Write a <a class="LINK_6" href="#robo10">Mifare</a> tag counter, using given key or internally available
   keys for authentication.
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   const BYTE snr[4]  : 4-byte UID of the <a class="LINK_12" href="#robo10">Mifare</a> card
                        If NULL, the reader will work with currently selected tag
   BYTE   bloc        : address of the block holding the counter
   SDWORD value       : new counter value
   const BYTE key[6]  : The <a class="LINK_12" href="#robo10">Mifare</a> access key of the sector (either B or A)
                        If NULL, the reader will try all the preloaded keys
</pre>
</span><p class="ITEM">WARNING</p>
<span class="WARNING"><pre class="WARNING">   This function works only on <a class="LINK_28" href="#robo10">Mifare</a> blocks that have been explicitly defined
   as counter (access condition <a class="LINK_28" href="#robo14">ACC_BLOCK_COUNT</a>).

   For more details, please refer to specific tag documentation.
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   MI_OK              : success, data have been read
   MI_NOTAGERR        : the required tag is not available in the RF field,
                        or the supplied key has been denied
   MI_AUTHERR         : access to the block has been denied
   Other code if internal or communication error has occured. 
</pre>
</span><p class="ITEM">NOTES</p>
<span class="NOTES"><pre class="NOTES">   The automatic key trying sequence is the same as in <a class="LINK_23" href="#robo84">SPROX_MifStWriteBlock</a>.
</pre>
</span><p class="ITEM">SEE ALSO</p>
<span class="SEE_ALSO"><pre class="SEE ALSO">   <a class="LINK_37" href="#robo77">SPROX_MifStReadCounter</a>
   <a class="LINK_37" href="#robo74">SPROX_MifStDecrementCounter</a>
</pre>
</span>


<h2><a name="robo86"><span class="TYPE">[Functions]</span><a class="LABEL" name="SPROX5fMifStWriteSector">
SPROX_MifStWriteSector</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./Copie de springprox_h.html#robo1">parent</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>SPROX_MifStWriteSector</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Write one sector of a <a class="LINK_6" href="#robo10">Mifare</a> tag, using given key or internally available
   keys for authentication.
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   const BYTE snr[4]       : 4-byte UID of the <a class="LINK_12" href="#robo10">Mifare</a> card to read
                             If NULL, the reader will work with currently selected tag
   BYTE bloc               : address of the sector to write
   const BYTE data[48/240] : 48-byte or 240-byte buffer of data
   const BYTE key[6]       : The <a class="LINK_12" href="#robo10">Mifare</a> access key of the sector (either B or A)
                             If NULL, the reader will try all the preloaded keys 
</pre>
</span><p class="ITEM">WARNING</p>
<span class="WARNING"><pre class="WARNING">   The number of sectors available on a <a class="LINK_28" href="#robo10">Mifare</a> tag depends on the tag type.
   The size of each sector depends both on the tag type and on the sector number.

   For more details, please see <a class="LINK_28" href="#robo78">SPROX_MifStReadSector</a> or refer to specific tag
   documentation.

   This function never writes the last block of each sector (security block or
   sector trailer). Explicitly use <a class="LINK_28" href="#robo83">SPROX_MifStUpdateAccessBlock</a> to write those
   blocks.
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   MI_OK              : success, data have been written
   MI_NOTAGERR        : the required tag is not available in the RF field,
                        or the supplied key has been denied
   MI_AUTHERR         : access to the sector has been denied
   Other code if internal or communication error has occured. 
</pre>
</span><p class="ITEM">NOTES</p>
<span class="NOTES"><pre class="NOTES">   The automatic key trying sequence is the same as in <a class="LINK_23" href="#robo84">SPROX_MifStWriteBlock</a>.
</pre>
</span><p class="ITEM">SEE ALSO</p>
<span class="SEE_ALSO"><pre class="SEE ALSO">   <a class="LINK_37" href="#robo84">SPROX_MifStWriteBlock</a>
</pre>
</span>


<h2><a name="robo87"><span class="TYPE">[Functions]</span><a class="LABEL" name="SPROX5fMifStWriteTag768">
SPROX_MifStWriteTag768</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./Copie de springprox_h.html#robo1">parent</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>SPROX_MifStWriteTag768</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Write a whole <a class="LINK_6" href="#robo10">Mifare</a> 1k tag (768 bytes), using internally available keys for
   authentication.
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   const BYTE snr[4]    : 4-byte UID of the <a class="LINK_12" href="#robo10">Mifare</a> card to write
                          If NULL, the reader will work with currently selected tag
   WORD *sectors        : pointer to a WORD used as bit-array
                          - in input, bit b(i) set means that sector i must be written
                          - in output, bit b(i) set means that sector i has been
                            successfully writen
   const BYTE data[768] : 768-byte buffer of data
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   MI_OK              : success, some data have been written. Check the *sectors bit-
                        array to see which sectors have been written
   MI_NOTAGERR        : the required tag is not available in the RF field,
                        or the supplied key has been denied
   Other code if internal or communication error has occured. 
</pre>
</span><p class="ITEM">NOTES</p>
<span class="NOTES"><pre class="NOTES">   The automatic key trying sequence is the same as in <a class="LINK_23" href="#robo84">SPROX_MifStWriteBlock</a>.
</pre>
</span><p class="ITEM">SEE ALSO</p>
<span class="SEE_ALSO"><pre class="SEE ALSO">   <a class="LINK_37" href="#robo84">SPROX_MifStWriteBlock</a>
   <a class="LINK_37" href="#robo86">SPROX_MifStWriteSector</a>
</pre>
</span>


<h2><a name="robo88"><span class="TYPE">[Functions]</span><a class="LABEL" name="SPROX5fMifWrite">
SPROX_MifWrite</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./Copie de springprox_h.html#robo1">parent</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>SPROX_MifWrite</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Write one 16-byte block of a <a class="LINK_6" href="#robo10">Mifare</a> card.
   No implicit authentication is performed ; this is typically the appropriate
   function to read from a <a class="LINK_6" href="#robo10">Mifare</a> UltraLight card.
</pre>
</span><p class="ITEM">WARNING</p>
<span class="WARNING"><pre class="WARNING">   <a class="LINK_28" href="#robo10">Mifare</a> UltraLight cards accept this command, but only the 4 first bytes are
   actually written (same behaviour as <a class="LINK_28" href="#robo89">SPROX_MifWrite4</a>).
   On a <a class="LINK_28" href="#robo10">Mifare</a> Standard card, authentication is mandatory, use <a class="LINK_28" href="#robo84">SPROX_MifStWriteBlock</a>.
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   const BYTE snr[4]   : 4-byte UID of the <a class="LINK_12" href="#robo10">Mifare</a> card to read
                         If NULL, the reader will work with currently selected card
   BYTE address        : address to write
   const BYTE data[16] : data to be written
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   MI_OK              : success, data have been written
   MI_NOTAGERR        : the required card is not available in the RF field
   Other code if internal or communication error has occured. 
</pre>
</span><p class="ITEM">SEE ALSO</p>
<span class="SEE_ALSO"><pre class="SEE ALSO">   <a class="LINK_37" href="#robo89">SPROX_MifWrite4</a>
   <a class="LINK_37" href="#robo73">SPROX_MifRead</a>
   <a class="LINK_37" href="#robo84">SPROX_MifStWriteBlock</a>
</pre>
</span>


<h2><a name="robo89"><span class="TYPE">[Functions]</span><a class="LABEL" name="SPROX5fMifWrite4">
SPROX_MifWrite4</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./Copie de springprox_h.html#robo1">parent</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>SPROX_MifWrite4</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Write one 4-byte block of a <a class="LINK_6" href="#robo10">Mifare</a> card.
   No implicit authentication is performed ; this is typically the appropriate
   function to read from a <a class="LINK_6" href="#robo10">Mifare</a> UltraLight card.
</pre>
</span><p class="ITEM">WARNING</p>
<span class="WARNING"><pre class="WARNING">   On a <a class="LINK_28" href="#robo10">Mifare</a> Standard card, authentication is mandatory and only 16-byte blocks can
   be written ; use <a class="LINK_28" href="#robo84">SPROX_MifStWriteBlock</a>.
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   const BYTE snr[4]  : 4-byte UID of the <a class="LINK_12" href="#robo10">Mifare</a> card to read
                        If NULL, the reader will work with currently selected card
   BYTE address       : address to write
   const BYTE data[4] : data to be written
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   MI_OK              : success, data have been written
   MI_NOTAGERR        : the required card is not available in the RF field
   Other code if internal or communication error has occured. 
</pre>
</span><p class="ITEM">SEE ALSO</p>
<span class="SEE_ALSO"><pre class="SEE ALSO">   <a class="LINK_37" href="#robo88">SPROX_MifWrite</a>
   <a class="LINK_37" href="#robo84">SPROX_MifStWriteBlock</a>
</pre>
</span>
<hr />
Generated from <b>sprox_mifare.c</b> on Thu Jun 24 12:26:29 2010<br />
</body>
</html>
